<template>
	<el-form :model="forms">
		<el-form-item label="年度" label-width="40px">
			<el-select v-model="forms.year" class="m-2" placeholder="选择年度">
				<el-option
					v-for="item in optionData"
					:key="item.value"
					:label="item.label"
					:value="item.value"
				/>
			</el-select>
		</el-form-item>
	</el-form>
</template>

<script lang="ts" setup>
import { ref, reactive, defineEmits, defineProps, computed } from 'vue'
const props = defineProps({
	form: {
		type: Object,
		required: true,
		default: () => {}
	}
})
let emit = defineEmits(['update:form'])
let forms = computed({
	get() {
		return props.form
	},
	set(val) {
		emit('update:form', val)
	}
})
let optionData=[]
function getYear () {
  var options = new Array(3);
  let currentDate = new Date().getFullYear()
 optionData= options.fill({value:'',label:''}).map((item, index) => {
    return {
      value: currentDate - index,
      label:currentDate-index,
    }
  })
    }
getYear()
</script>
